Reinstate gtk_toolbar_content_new_compatibility() that was mistakenly
authorMatthias Clasen <mclasen@redhat.com>
Mon, 29 Jan 2007 03:24:09 +0000 (03:24 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 29 Jan 2007 03:24:09 +0000 (03:24 +0000)
2007-01-28  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtktoolbar.c: Reinstate gtk_toolbar_content_new_compatibility()
        that was mistakenly "cleaned up" a while ago. Also
        revert a problematic change to the screen_changed
        handler.  (#401598, Søren Sandmann)

svn path=/trunk/; revision=17232

ChangeLog
gtk/gtktoolbar.c

index a33baa75f63308b6ca0ec3f4c5deb37aa0c4981d..a8809cf8cc97338f18c66d005fa1f01f77f238f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-28  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtktoolbar.c: Reinstate gtk_toolbar_content_new_compatibility()
+       that was mistakenly "cleaned up" a while ago. Also
+       revert a problematic change to the screen_changed
+       handler.  (#401598, Søren Sandmann)
+
 2007-01-28  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkframe.c (gtk_frame_size_allocation): Fix a 
index 8a37dc850030c2266d03c932b428f0510956e143..55384e245e94707b768e2d201841c9fa16db8398 100644 (file)
@@ -38,6 +38,7 @@
 #include "gtkseparatortoolitem.h"
 #include "gtkmenu.h"
 #include "gtkradiobutton.h"
+#include "gtktoolbar.h"
 #include "gtkbindings.h"
 #include <gdk/gdkkeysyms.h>
 #include "gtkmarshalers.h"
@@ -242,6 +243,12 @@ static ToolbarContent *toolbar_content_new_tool_item        (GtkToolbar
                                                             GtkToolItem         *item,
                                                             gboolean             is_placeholder,
                                                             gint                 pos);
+static ToolbarContent *toolbar_content_new_compatibility    (GtkToolbar          *toolbar,
+                                                            GtkToolbarChildType  type,
+                                                            GtkWidget           *widget,
+                                                            GtkWidget           *icon,
+                                                            GtkWidget           *label,
+                                                            gint                 pos);
 static void            toolbar_content_remove               (ToolbarContent      *content,
                                                             GtkToolbar          *toolbar);
 static void            toolbar_content_free                 (ToolbarContent      *content);
@@ -1444,6 +1451,7 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
   GtkRequisition arrow_requisition;
   gboolean overflowing;
   gboolean size_changed;
+  gdouble elapsed;
   GtkAllocation item_area;
   GtkShadowType shadow_type;
   
@@ -1727,6 +1735,7 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
        }
     }
 
+  elapsed = g_timer_elapsed (priv->timer, NULL);
   for (list = priv->content, i = 0; list != NULL; list = list->next, ++i)
     {
       ToolbarContent *content = list->data;
@@ -2073,13 +2082,13 @@ gtk_toolbar_screen_changed (GtkWidget *widget,
                           toolbar);
 
       priv->settings = g_object_ref (settings);
-
-      style_change_notify (toolbar);
-      icon_size_change_notify (toolbar);
-      animation_change_notify (toolbar);
     }
   else
     priv->settings = NULL;
+
+  style_change_notify (toolbar);
+  icon_size_change_notify (toolbar);
+  animation_change_notify (toolbar);
 }
 
 static int
@@ -3737,6 +3746,7 @@ internal_insert_element (GtkToolbar          *toolbar,
                         gboolean             use_stock)
 {
   GtkWidget *box;
+  ToolbarContent *content;
   char *free_me = NULL;
 
   GtkWidget *child_widget;
@@ -3846,6 +3856,9 @@ internal_insert_element (GtkToolbar          *toolbar,
                            tooltip_text, tooltip_private_text);
     }
   
+  content = toolbar_content_new_compatibility (toolbar, type, child_widget,
+                                              child_icon, child_label, position);
+  
   if (free_me)
     g_free (free_me);
   
@@ -3920,6 +3933,54 @@ toolbar_content_new_tool_item (GtkToolbar  *toolbar,
   return content;
 }
 
+static ToolbarContent *
+toolbar_content_new_compatibility (GtkToolbar          *toolbar,
+                                  GtkToolbarChildType  type,
+                                  GtkWidget            *widget,
+                                  GtkWidget            *icon,
+                                  GtkWidget            *label,
+                                  gint                  pos)
+{
+  ToolbarContent *content;
+  GtkToolbarChild *child;
+  GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
+  
+  content = g_new0 (ToolbarContent, 1);
+
+  child = &(content->u.compatibility.child);
+  
+  content->type = COMPATIBILITY;
+  child->type = type;
+  child->widget = widget;
+  child->icon = icon;
+  child->label = label;
+  
+  if (type != GTK_TOOLBAR_CHILD_SPACE)
+    {
+      gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar));
+    }
+  else
+    {
+      content->u.compatibility.space_visible = TRUE;
+      gtk_widget_queue_resize (GTK_WIDGET (toolbar));
+    }
+  if (type == GTK_TOOLBAR_CHILD_BUTTON ||
+      type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON ||
+      type == GTK_TOOLBAR_CHILD_RADIOBUTTON)
+    {
+      set_child_packing_and_visibility (toolbar, child);
+    }
+
+  priv->content = g_list_insert (priv->content, content, pos);
+  toolbar->children = g_list_insert (toolbar->children, child, pos);
+  priv->need_rebuild = TRUE;
+  
+  toolbar->num_children++;
+  
+  return content;
+}
+
 static void
 toolbar_content_remove (ToolbarContent *content,
                        GtkToolbar     *toolbar)